import 'dart:html';

void main() {
  print("hey");

  if (query("#footer") != null) {
    query("#footer").onClick.listen(reverseText);
  }

  for (DivElement div in queryAll('div .tab-pane')) {
    div.text = codeSample;
  }
}

void reverseText(MouseEvent event) {
  var text = query("#footer").text;
  var buffer = new StringBuffer();
  for (int i = text.length - 1; i >= 0; i--) {
    buffer.write(text[i]);
  }
  query("#footer").text = buffer.toString();
}

final String codeSample = """import 'dart:html';
import 'package:web_ui/web_ui.dart';

// initial value for click-counter
int startingCount = 5;

void main() {
  // Enable this to use Shadow DOM in the browser.
  //useShadowDom = true;
}""";
